#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int N = 5e4 + 10;

int n;
int a[N], b[N];

void solve(){
    cin >> n;
    for(int i = 1; i <= n; i ++) cin >> a[i];
    for(int i = 1; i <= n; i ++) cin >> b[i];

    int op = 0;     // 0 >=    1 ==
    int k = 0;

    for(int i = 1; i <= n; i ++){
        if(b[i] == 0){
            if(op == 1){
                if(a[i] - b[i] > k){
                    cout << "NO" << '\n';
                    return;
                }
            }else{ // op == 0
                if(a[i] - b[i] > k){
                    k = a[i] - b[i];
                }
            }
        }else{ // b[i] != 0;
            if(op == 1){
                if(a[i] - b[i] != k){
                    cout << "NO" << '\n';
                    return;
                }
            }else{ // op == 0
                if(a[i] - b[i] >= k){
                    op = 1;
                    k = a[i] - b[i];
                }else{
                    cout << "NO" << '\n';
                    return;
                }
            }
        }
    }

    cout << "YES" << '\n';


    
}

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    cin >> T;
    while(T--){
        solve();
    }


    return 0;
}